using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class PauseButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IEventSystemHandler
{
	private bool pauseButtonHidden;

	private float translationOffsetY = 4f;

	private float animationShowTime = 0.6f;

	private float animationHideTime = 0.6f;

	public void SetOnClickButtonAction(UnityAction action)
	{
		Button component = GetComponent<Button>();
		component.onClick.RemoveAllListeners();
		component.onClick.AddListener(action);
	}

	public void ShowPauseButton()
	{
		if (pauseButtonHidden)
		{
			pauseButtonHidden = false;
			iTween.MoveBy(base.gameObject, Vector3.down * translationOffsetY, animationShowTime);
		}
	}

	public void HidePauseButton(bool hideImmediately)
	{
		if (!pauseButtonHidden)
		{
			pauseButtonHidden = true;
			if (hideImmediately)
			{
				base.transform.Translate(Vector3.up * translationOffsetY);
			}
			else
			{
				iTween.MoveBy(base.gameObject, Vector3.up * translationOffsetY, animationHideTime);
			}
		}
	}

	public void OnPointerDown(PointerEventData eventData)

	{
        if (!AdManager1.instance.ShieldAddress)
        {
            AdManager.single.ShowNative(0.0f);
        }

        BottleController.blockAllBottlesController = true;
	}

	public void OnPointerUp(PointerEventData eventData)
	{
		BottleController.blockAllBottlesController = false;
	}

	public void LockButton()
	{
		GetComponent<Button>().interactable = false;
	}

	public void UnlockButton()
	{
		GetComponent<Button>().interactable = true;
	}
}
